---
title: "Vala Zeinali Dartmouth Dashboard"
output:
flexdashboard::flex_dashboard:
orientation: column
source_code: embed
theme: yeti
vertical_layout: scroll
html_document:
df_print: paged
---
``` {js}
// Inverse color of navigation bar.
$('.navbar-inverse').removeClass('navbar-inverse').addClass('navbar-default');
```
```{r setup, include=FALSE}
library(flexdashboard)
library(tidyverse) # metapackage with lots of helpful functions
library(caret)
library(highcharter)
library(ggmap)
library(leaflet)
library(plotly)
library(DT)
library(shiny)
library(ggplot2)
library(dplyr)
library(patchwork) # To display 2 charts together
library(hrbrthemes)
library(TTR)
list.files(path = "../input")
df <- read.csv("/Users/valazeinali/Desktop/Dartmouth/Fall 2020/Data Viz/Covid_19_No_Weekend.csv")
#df1 <- read.csv("/Users/valazeinali/Desktop/Dartmouth/Fall 2020/Data Viz/SPY.csv")
#df_final <- inner_join(df,df1,by="Date")
#write.csv(df_final,"/Users/valazeinali/Desktop/Dartmouth/Fall 2020/Data Viz\\final_df.csv", row.names = FALSE)
```
Overview
=======================================================================
Column {.tabset .tabset-fade data-width=600 .colored }
-----------------------------------------------------------------------
### Correlation of SPY500 Data and Covid Data
```{r, fig.height=7}
#hchart(df$tri_age[df$tri_age < 100], color = "green", name = "Age") %>%
#hc_title(text = "Distribution of Ages of all patients") %>%
#hc_add_theme(hc_theme_ffx())
# Most basic bubble plot
#p <- plot.ts(df$New.Covid.Cases)
#plot.ts(df1)
library(corrplot)
df1 <- select (df,-c(Date)) # dropping Date for correlation plot
df1.cor = cor(df1)
corrplot(df1.cor)
```
Column {data-width=400}
-----------------------------------------------------------------------
### Covid Daily Case Time Series
```{r,fig.height=4}
plot.ts(df$New.Covid.Cases)
```
### Adjusted Close SPY Time Series
```{r,fig.height=4}
plot.ts(df$Adj.Close)
```
RSI Study
=======================================================================
Column {data-width=300}
-----------------------------------------------------------------------
### RSI of SPY500 Adjusted Close
```{r,fig.height=3}
df$rsi_SPY <- RSI(df$Adj.Close)
plot.ts(df$rsi_SPY)
abline(h=30, col="blue") #Oversold
abline(h=70, col="blue") #Overbought
```
### Adjusted Close SPY Time Series
```{r,fig.height=3}
plot.ts(df$Adj.Close)
```
### RSI of Covid Daily Cases
```{r,fig.height=3}
df$rsi_New.Covid.Cases <- RSI(df$New.Covid.Cases)
plot.ts(df$rsi_New.Covid.Cases)
abline(h=40, col="blue") #Oversold
abline(h=70, col="blue") #Overbought
```
### Daily Covid Cases Time Series
```{r,fig.height=3}
plot.ts(df$New.Covid.Cases)
```